#include <game.h>
#include <map.h>

bool crash(int lvl) {
    int ax = avatar.x;
    int ay = avatar.y;
    int bx, by;
    for (int i=0; i<BLOCK_NUM; i++) {
        bx = blocks[lvl][i].x;
        by = blocks[lvl][i].y;
        if (ax+AVATAR_SZ>bx+3 && ax < bx+BLOCK_WIDTH-3 && ay+AVATAR_SZ > by+3 && ay < by+BLOCK_HEIGHT-3) {
            printf("No!\n");
            return true;
        }
    }
    return false;
}

bool hit() {
    if (avatar.x>width) {
        avatar.x %= width;
        return true;
    }
    return false;
}